#ifndef ERROR_H
#define ERROR_H
#include "Token.h"
#include <string>
#include <iostream>
class Error
{
	std::string des;
public:
	Error(const std::string& Des): des(Des) {}
	virtual void showMsg()
	{
		Context* ctx = Context::getInstance();
		std::string source = ctx -> source[ctx -> getRow() - 1]; // not graceful
		(ctx -> stdErr()) << "Error: " << des << std::endl;
		(ctx -> stdErr()) << "  Line " << (ctx -> getRow()) << ": " << "\"" << (source.substr(1, source.size()-1)) << "\"" << std::endl;
	}
};

class ErrorBreak: public Error
{
public:
	ErrorBreak(): Error("Unexpected \"break\".") {}
};

class ErrorExit: public Error
{
public:
	ErrorExit(): Error("Exit.") {}
};
#endif

